<%@ page language="java" pageEncoding="utf-8"%>
<%@ include file="../includes/importer.jsp"%>
<!doctype html>
<html>
<head>
<ht:head />
<script src="<spring:url value="/static/js/uploadify/jquery.uploadify.js"/>" type="text/javascript" charset="utf-8"></script>
<link href="<spring:url value="/static/js/uploadify/uploadify.css"/>" rel="stylesheet" type="text/css" />
<script type="text/javascript">

$().ready(function() {
	
	selectRegionCallBack("#areaName",function(id,txt){ //选择归属地市，自动填充 行政地市
		$("#areaCode").val(id);
		$("#areaName").val(txt);
		//自动填充归属地市
		$("#areaId").val(id);
		$("#areaIdName").val(id);
		
		$("#areaName").focus();
		$("#areaName").blur();
	},'${pid}',{maxItems:1,flag:1});
	
	//selectRegionCallBack("#areaIdName",function(id,txt){ //选择 行政地市
		//自动填充归属地市
		//$("#areaId").val(id);
		//$("#areaIdName").val(txt);
	//},'${pid}',{maxItems:1,index:100});
	
	//上传图片
	$("#uploadPropertyPic").uploadify({
		height        : 25,
		removeCompleted:true,
		swf           : G_CTX_ROOT + '/static/js/uploadify/uploadify.swf',
		width         : 90,
		uploader:  "${ctx}/imgUpload/store/${uploadImgId};jsessionid=<%=request.getRequestedSessionId()%>",
						onUploadSuccess : function(file, data, response) {
							var timestamp = new Date().getTime();
							$("#logoImg").attr("src", data + "?d=" + timestamp);
							$("#imgPath").val(data);
						}
					});
	
});

function deltr(id){   
    $('#tr'+id).remove();    
} 

function sub(){
	
}

function subFom() {
	var imgPath = $("#imgPath").val();
	if(!imgPath) {
    	simpleWarn("请上传图片!", null);
    	return false;
	}
}

</script>

</head>
<body>
	<div id="content">
		<!-- forms -->
		<div class="box">
			<!-- box / title -->
			<div  class="title">
				<h5>商户基本信息添加</h5>
			</div>
			<form:form method="post" id="fm" commandName="store" action="?" onsubmit="sub();" htmlEscape="true" acceptCharset="utf-8" cssClass="required-validate" >
				<div class="form">
					<div class="fields">

						<div class="field">
							<div class="label">
								<label for="name" class="req">商户名称：</label>
							</div>
							<div class="input">
								<!-- small medium large -->
								<form:input path="name" cssClass="small required" maxlength="25" />
								<span class="error" id="advice-required-userPwd"
									style="display:none"></span>
							</div>
						</div>
						
						<div class="field">
							<div class="label">
								<label for="areaName" class="req">归属地市:</label>
							</div>
							<div class="input">
								<form:input path="areaName" cssClass="small required"
									maxlength="100" readonly="true"/>
								<form:hidden path="areaCode"  />	
								<span class="error" id="advice-required-userPwd"
									style="display:none"></span>
							</div>
						</div>
                		
                		<div class="field">
							<div class="label">
								<label for="address" class="req">通信地址:</label>
							</div>
							<div class="input">
								<form:input path="address" cssClass="small required"
									maxlength="50" />
								<span class="error" id="advice-required-userPwd"
									style="display:none"></span>
							</div>
						</div>
											
						<div class="field">
                    	<div class="label">
                        <label for="linkName" class="req">联系人:</label>
                    	</div>
                    	<div class="input">
                     	<form:input path="linkName" cssClass="small required validate-chinese"  maxlength="50" />
                         <span class="error" id="advice-validate-chinese-linkName" style="display:none"></span>
                    	</div>
               		</div>
						
					<div class="field">
                    	<div class="label">
                        <label for="linkPhone" class="req">联系电话:</label>
                    	</div>
                    	<div class="input">
                     	<form:input path="linkPhone" cssClass="small required " maxlength="20" />
                         <span class="error" id="advice-required-phone" style="display:none"></span>
                    	</div>
                	</div>
                	
                	<div class="field">
                    	<div class="label">
                        <label for="email" class="req">邮箱:</label>
                    	</div>
                    	<div class="input">
                     		<form:input path="email" cssClass="small required validate-email" maxlength="50" />
                    	</div>
                	</div>
                	
                	<div class="field">
                    	<div class="label">
                    		<label for="uploadfile" class="req">商户LOGO：</label>
	                    </div>
	                    <div class="input">
	                    	<img src="${ctx }/static/images/zwtp.png" id="logoImg" style="background: #ECE9D8" height="95" width="130">
	                    </div>
	                    <div class="input" style="width: 120px;" >
	                    	<input type="file" id="uploadPropertyPic" name="uploadPropertyPic" style="display:none; margin-left: 10px;"  size="0" />
	                    	<input type="hidden" name="imgPath" id="imgPath" cssClass="required">
	                   	</div>
	                    <div class="img-size-desc" style="margin-left: 79px; color: red;">建议图片大小为 800*800 或 600*600</div>
                	</div>
							       
						<div class="buttons">
							<div class="highlight">
								<input type="submit" name="submit.highlight" value="提交" onclick="return subFom()" />
							</div>
							<input type="reset" name="reset" value="重置" /> 
							<input type="button" class="common_btn" onclick="history.back();" value="返回" />
						</div>
					</div>
				</div>
			</form:form>
		</div>
		<!-- end forms -->
	</div>
</body>
</html>